import 'package:common/export/get_it.dart';
import 'package:flutter/material.dart';
import 'package:common/export/flex_color.dart';
import 'package:theme/colors.dart';
import 'package:theme/font_size.dart';
import 'package:theme/state/theme/theme_cubit.dart';
import 'package:common/export/tools.dart';

class LaraPressTheme {
  static ThemeData createTheme() {
    // f7f7f9
    Color surfaceContainerLow = Color.fromRGBO(247, 247, 249, 1);
    ThemeData theme = FlexThemeData.light(
      scheme: FlexScheme.red,
      primary: LaraPressColors.primary,
      blendLevel: 0,
      fontFamily: 'NotoSansSC',
      textTheme: getTextTheme(),
      scaffoldBackground: Color.fromRGBO(240, 243, 249, 1),
      bottomAppBarElevation: 0,
      colorScheme: ColorScheme.light(
        primary: LaraPressColors.primary,
        onPrimary: Colors.white,
        surfaceContainerLow: surfaceContainerLow,
        surfaceContainer: surfaceContainerLow,
        onSurfaceVariant: HexColor("#b9bbbf"),
      ),
      subThemesData: FlexSubThemesData(
        inputDecoratorBorderWidth: 0,
        inputDecoratorFocusedBorderWidth: 0,
        inputDecoratorBorderType: FlexInputBorderType.outline,
        inputDecoratorFocusedHasBorder: false,
        inputDecoratorIsFilled: true,
        inputDecoratorUnfocusedHasBorder: false,
        inputDecoratorFillColor: surfaceContainerLow,
        bottomNavigationBarElevation: 0,
      ),
    );
    theme = theme.copyWith(
      appBarTheme: theme.appBarTheme.copyWith(
        backgroundColor: Colors.white,
        centerTitle: true,
        surfaceTintColor: Colors.transparent,
      ),
      tabBarTheme: theme.tabBarTheme.copyWith(dividerHeight: 0),

      cardColor: Colors.white,
    );
    return theme;
  }

  static void setupLaraPressTheme() {
    laraPressGetIt.registerSingleton<LaraPressThemeCubit>(
      LaraPressThemeCubit(),
    );
  }

  static TextTheme getTextTheme() {
    return TextTheme(
      titleLarge: TextStyle(fontWeight: FontWeight.bold),
      titleMedium: TextStyle(
        fontSize: LaraPressFontSize.listTitle,
        color: LaraPressColors.defaultText,
        fontWeight: FontWeight.bold,
      ),
      titleSmall: TextStyle(),
      bodyLarge: TextStyle(),
      bodyMedium: TextStyle(fontSize: LaraPressFontSize.listContent),
      bodySmall: TextStyle(fontSize: LaraPressFontSize.listMeta),
      labelLarge: TextStyle(),
      labelMedium: TextStyle(),
      labelSmall: TextStyle(),
      headlineLarge: TextStyle(
        fontSize: LaraPressFontSize.detailTitle,
        fontWeight: FontWeight.bold,
      ),
      headlineMedium: TextStyle(),
      headlineSmall: TextStyle(),
      displayLarge: TextStyle(),
      displayMedium: TextStyle(),
      displaySmall: TextStyle(),
    );
  }
}
